package com.csdn;

public class Test5 {
    public static void main(String[] args) {
        F d=new S();
        System.out.println(d.sum());
        System.out.println(d.sum2());
    }
}

class F{
    public int i=10;
    public int sum(){
        return getI()+20;
    }
    public int sum2(){
        return i+20;
    }
    public int getI(){
        return i;
    }
}

class S extends F{
    public int i=70;
    //将下面注释注销再运行看看
//    public int sum(){
//        return getI()+30;
//    }
//    public int sum2(){
//        return i+50;
//    }
    public int getI() {
        return i;
    }
}